<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<h1></h1>

<script>
    var time = 10
    var obj = setInterval(function () {
        time = time - 1;
        console.log(time);
        if (time === 0) {
            clearInterval(obj);
        }
    }, 1000)


</script>

</body>
</html>